package hu.mapro.gwtui.client.impl;

import hu.mapro.gwtui.client.Action;
import hu.mapro.gwtui.client.Display;
import hu.mapro.gwtui.client.LoginInterface;
import hu.mapro.gwtui.client.Menu;
import hu.mapro.gwtui.client.Window;
import hu.mapro.gwtui.client.login.DefaultLoginService;
import hu.mapro.gwtui.client.login.LoginUiBuilder;

import com.google.inject.Inject;
import com.google.inject.Singleton;

@Singleton
public class DefaultUiBuilder {

	DefaultLoginService loginService;
	Window window;
	Display display;
	LoginUiBuilder loginUiBuilder;

	@Inject
	public DefaultUiBuilder(DefaultLoginService loginService, Window window,
			Display display, LoginUiBuilder loginUiBuilder) {
		super();
		this.loginService = loginService;
		this.window = window;
		this.display = display;
		this.loginUiBuilder = loginUiBuilder;
	}

	public void build() {
		loginService.getLoginWindow().setShowRememberMe(true);
		loginUiBuilder.build();
	}

	public void display() {
		loginService.initLogin(new Action() {
			@Override
			public void perform() {
				window.display(display);
			}
		});
	}

}
